#include <iostream>
using namespace std;

int main()
{
    int t = 0;
    int h,a,H,A;
    int temp = 0;
    cin >> t;
    
    while(t--)
    {
        cin >> h >> a >> H >> A;
        temp = H;
        int count = 0;
        
        if(a >= H)
        {
            cout << -1 << endl;
            continue;
        }
        
        while(h > 0)
        {
            temp -= a;
            
            if(temp <= 0)
            {
                count++;
                temp = H;
                continue;
            }
            
            h -= A;
        }
        
        cout << count << endl;
    }
    
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n = 0; cin >> n;
    if(n == 0)
    {
        cout << 0;
        return 0;
    }

    int count = 1;

    vector<string> v_strs(n);

    for(int i = 0; i < n; i++) 
    {
        cin >> v_strs[i];
        sort(v_strs[i].begin(), v_strs[i].end());
    }

    sort(v_strs.begin(), v_strs.end());

    for(int i = 1; i < n; i++)
    {
        if(v_strs[i] != v_strs[i-1])
        {
            count++;
        }
    }

    cout << count;

    return 0;
}


class Solution {
public:
    int citys(vector<vector<int> >& m) {
        vector<bool> visited(210, false);
        int count = 0;

        for(int i = 0; i < m[0].size(); ++i)
        {
            if(!visited[i])
            {
                bfs(m, visited, i);
                count++;
            }
        }

        return count;
    }
private:
    void bfs(vector<vector<int>>& m, vector<bool>& visited, int city_index)
    {
        queue<int> q;
        q.push(city_index);
        visited[city_index] = true;

        while(!q.empty())
        {
            int x = q.front();
            q.pop();
            
            for(int j = 0; j < m.size(); j++)
            {
                if(m[x][j] == 1 && !visited[j])
                {
                    visited[j] = true;
                    q.push(j);
                }
            }
        }
    }
};


// [1,0,0,0,1,0,0,1,1,0,0,0,0],
// [0,1,0,0,0,0,0,0,0,0,0,0,0],
// [0,0,1,0,0,0,0,0,0,0,0,0,0],
// [0,0,0,1,0,0,1,0,0,1,0,0,0],
// [1,0,0,0,1,0,0,0,1,0,0,0,0],
// [0,0,0,0,0,1,0,1,0,0,0,0,0],
// [0,0,0,1,0,0,1,1,0,0,0,0,0],
// [1,0,0,0,0,1,1,1,0,0,1,0,0],
// [1,0,0,0,1,0,0,0,1,0,0,1,0],
// [0,0,0,1,0,0,0,0,0,1,1,0,0],
// [0,0,0,0,0,0,0,1,0,1,1,0,0],
// [0,0,0,0,0,0,0,0,1,0,0,1,1],
// [0,0,0,0,0,0,0,0,0,0,0,1,1]


